﻿using UnityEngine;
using System.Collections;

public class tankAttack : MonoBehaviour {

    public GameObject firePrefab;
    public Transform firePosition;

    public float speed;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	    if(Input.GetKeyDown(KeyCode.Space))
        {
            GameObject bullet = GameObject.Instantiate(firePrefab, firePosition.position,firePosition.rotation) 
                as GameObject;
            Rigidbody rb = bullet.GetComponent<Rigidbody>();
            rb.velocity = transform.forward * speed;
        }
	}
}
